<%--
  Created by IntelliJ IDEA.
  User: kuankuan
  Date: 2023/3/7
  Time: 9:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <script src="/js/jquery-1.12.4.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <style>
        body{
            background-image: linear-gradient(skyblue,pink);
        }
        *{
            font-family: "楷体";
            font-size: 3.0rem;
        }
        .a{
            display: inline-block;
            padding: 50px;
            cursor: pointer;
        }

        .D{
            font-size: 5.0rem;
            text-align: center;
            background-image:-webkit-linear-gradient(red,black);
            -webkit-background-clip:text;
            -webkit-text-fill-color:transparent;
        }
        a:hover{
            background-color: skyblue;
        }
    </style>
</head>
<body>
<h3>当前用户: ${sessionScope.login_user.username}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当前余额：${sessionScope.login_user.balance}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="/users?action=update1&user_id=${sessionScope.login_user.user_id}&balance=${sessionScope.login_user.balance}">充值</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <a href="/dinner_table1">预约餐桌</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="/login">退出登录</a>
</h3>
<div style="display:block; height: 30px"></div>
<div style="display:block; height: 100px" class="D">欢迎光临</div>
<h1>请选择桌子</h1>
<table align="center">
    <tr>
        <c:forEach var="dinner_table" items="${requestScope.pageBean1.datas}">
            <a class="a" onclick="UpdateUser(${dinner_table.table_status}, ${dinner_table.table_id})">${dinner_table.table_name}<br>
                <c:choose>
                    <c:when test="${dinner_table.table_status==1}">
                        <p>状态：已被预订</p>
                    </c:when>
                    <c:when test="${dinner_table.table_status==2}">
                        <p>状态：正在使用</p>
                    </c:when>
                    <c:otherwise>
                        <p>状态：空闲</p>
                    </c:otherwise>
                </c:choose>
            </a>

        </c:forEach>
    </tr>
</table>

<script>
    function UpdateUser(status, id){
        if(confirm('是否确认'+status+"?")) {
            if(status==1){
                alert("已被预订，请重新选择")
            }
            open('/userlook?table_id='+id+'&table_status='+status,'_self')
        }
    }
</script>
</body>
</html>
